﻿using App.Components;
using App.DAL;
using FreeSql;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace App.Areas.Admins.Controllers
{
    public class SysUserController : BaseController
    {
        public IActionResult Index()
        {
            //List<SysUser> s = new List<SysUser>();
            //for (int i = 0; i < 500000; i++)
            //{
            //    SysUser sysUser = new SysUser();
            //    sysUser.Account = $"Account{i + 1}";
            //    sysUser.NickName = $"NickName{i + 1}";
            //    sysUser.RealName = $"RealName{i + 1}";
            //    sysUser.Mobile = $"{17706777990 + i}";
            //    s.Add(sysUser);
            //}
            //SysUser.Db.AddRange(s);
            //SysUser.Db.SaveChanges();
            return View();
        }

        [HttpGet]
        public IActionResult GetGridJson(LayUIPagination pagination)
        {
            List<SysUser> users = SysUser.Search().OrderByDescending(x=>x.CreateDt).Page(pagination).ToList();
           
            return Content(users, pagination);
        }
    }
}
